Skip to content

Fix type argument inference of session.get(key) and session.set(key, value)#249

Merged
mcollina merged 2 commits intofastify:masterfrom
zetaraku:patch-1
May 7, 2024
Merged

Fix type argument inference of session.get(key) and session.set(key, value)#249
mcollina merged 2 commits intofastify:masterfrom
zetaraku:patch-1

Conversation

@zetaraku
Copy link
Copy Markdown
Contributor

@zetaraku zetaraku commented Apr 29, 2024

The current generic method session.get(key) accidentally allows the return value to be inferred into any type.

The session.set(key, value) also allows value of any type to be passed in.

Image

Note: This fix removes the second generic param V, so it will break an undocumented usage for TypeScript users specifying both two generic type parameters. (This should be rare.)

Checklist

Signed-off-by: Raku Zeta <zetaraku@gmail.com>
Signed-off-by: Raku Zeta <zetaraku@gmail.com>
Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 90ee1f5 into fastify:master May 7, 2024
@zetaraku zetaraku deleted the patch-1 branch May 23, 2024 15:49
@zetaraku zetaraku mentioned this pull request Jul 3, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants